/*
        Firesoft 
        
    Copyright (C) 2010, Arttu Viljakainen 
    Published under GNU General Public License V3 
    (see http://www.gnu.org/licenses/licenses.html)
    
    This file is part of Firesoft.

    Firesoft is free software: 
    you can redistribute it and/or modify it under the terms of the GNU General 
    Public License as published by the Free Software Foundation, 
    either version 3 of the License, or (at your option) any later version.

    Firesoft is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 
    Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Tool for Path Finding Algorithm Testing. If not, see         
    <http://www.gnu.org/licenses/>.
 */
package softstarter.gui.subareas.commandline;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import softstarter.gui.subareas.FireActionsController;


public class CommandlineTypingListener implements KeyListener {

    private FireActionsController controller;
    
    public CommandlineTypingListener(FireActionsController controller) {
    	this.controller = controller;
    }
    
    @Override
    public void keyPressed(KeyEvent arg0) {
        
    }

    @Override
    public void keyReleased(KeyEvent arg0) {
        
    }

    @Override
    public void keyTyped(KeyEvent event) {
    	System.out.println(this.getClass().getName() + " " + "keyTyped");
        if((int)event.getKeyChar() == 10) { // Enter
            controller.startSoftware(); 
        } else {
            controller.updateTopHitsListToCommandLine("" + event.getKeyChar());
        }
        
    }

}
